package com.shop.login.service.impl;

import com.shop.login.entiyy.Users;
import com.shop.login.dao.WYWUserMapper;
import com.shop.login.service.WYWUserService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class WYWUserServiceImpl implements WYWUserService {

    @Autowired
    private WYWUserMapper WYWUserMapper;

    /**
     * 用户登录
     * @param account   账号
     * @param password  密码
     * @return
     */
    @Override
    public boolean selectLogin(@Param(value = "account") String account,@Param(value = "password") String password) {
        Integer integer = WYWUserMapper.selectLogin(account, password);
        if (integer==1){    //判断项目是否存在
            return true;    //存在登录
        }
        return false;
    }

    /**
     * 注册用户信息
     * @param user  用户类
     * @return
     */
    @Override
    public boolean insertUser(Users users) {
        Integer integer = WYWUserMapper.insertUser(users);
        if (integer>0){
            return true;
        }
        return false;
    }

    /**
     * 根据账号修改密码
     * @param user  用户类
     * @return
     */
    @Override
    public boolean updateUser(Users users) {
        Integer integer = WYWUserMapper.updateUser(users);
        if (integer>0){
            return true;
        }
        return false;
    }
}
